/*
 *
 * Interface grafica-UserData  
 * Esta Classe serve para criar um novo jogo e estabelecer ligaçao.
 */

package battle.ship.uinterface;



/**
 *
 * @author Carlos
 */
public class userdata extends javax.swing.JFrame {
    /**
     * Creates new form userdata
     */
    private String namePlayer;
    public userdata() {
        initComponents();
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jtnamePlayer = new javax.swing.JTextField();
        jltext1 = new javax.swing.JLabel();
        jrbServidor = new javax.swing.JRadioButton();
        jrbCliente = new javax.swing.JRadioButton();
        jbAccept = new javax.swing.JButton();
        jbDeny = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        jtIPServer = new javax.swing.JTextField();
        jlText2 = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JSeparator();
        jbConnect = new javax.swing.JButton();
        jlText3 = new javax.swing.JLabel();
        jlText4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setAlwaysOnTop(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        getContentPane().add(jtnamePlayer, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 10, 320, -1));

        jltext1.setText("Nome:");
        getContentPane().add(jltext1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, 20));

        buttonGroup1.add(jrbServidor);
        jrbServidor.setText("Servidor");
        getContentPane().add(jrbServidor, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 80, 37));

        buttonGroup1.add(jrbCliente);
        jrbCliente.setText("Cliente");
        getContentPane().add(jrbCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 60, 80, 37));

        jbAccept.setText("Aceitar");
        jbAccept.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbAcceptActionPerformed(evt);
            }
        });
        getContentPane().add(jbAccept, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 190, 170, 37));

        jbDeny.setText("Cancelar");
        jbDeny.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbDenyActionPerformed(evt);
            }
        });
        getContentPane().add(jbDeny, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 190, 170, 37));
        getContentPane().add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 180, 380, 10));
        getContentPane().add(jtIPServer, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 110, 220, -1));

        jlText2.setText("Endereço IP Servidor:");
        getContentPane().add(jlText2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 100, -1, 30));
        getContentPane().add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 50, 420, -1));

        jbConnect.setText("Estabelcer ligação");
        getContentPane().add(jbConnect, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, 140, 30));

        jlText3.setText("Estado da ligação:");
        getContentPane().add(jlText3, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 150, -1, -1));

        jlText4.setText("0");
        getContentPane().add(jlText4, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 150, 20, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbDenyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbDenyActionPerformed
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_jbDenyActionPerformed

    private void jbAcceptActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbAcceptActionPerformed
        this.namePlayer = this.jtnamePlayer.getText();
        this.setVisible(false);
        this.dispose();
        
    }//GEN-LAST:event_jbAcceptActionPerformed

    public String setNamePlayer(){
        return namePlayer;
       
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JButton jbAccept;
    private javax.swing.JButton jbConnect;
    private javax.swing.JButton jbDeny;
    private javax.swing.JLabel jlText2;
    private javax.swing.JLabel jlText3;
    private javax.swing.JLabel jlText4;
    private javax.swing.JLabel jltext1;
    private javax.swing.JRadioButton jrbCliente;
    private javax.swing.JRadioButton jrbServidor;
    private javax.swing.JTextField jtIPServer;
    private javax.swing.JTextField jtnamePlayer;
    // End of variables declaration//GEN-END:variables
}
